package com.orcamento;

import org.junit.After;
import org.junit.Before;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
import org.springframework.transaction.annotation.Transactional;

import com.orcamento.integration.DataBaseTestConfigurer;

@ContextConfiguration({
		"classpath:spring/applicationContext.xml",
		"classpath:spring/dataSource.xml",
		"classpath:spring/pageObjectContext.xml",
		"classpath:spring/seleniumContext.xml"
})
@Transactional
public class AbstractWebSystemTest extends AbstractJUnit4SpringContextTests {
	
	@Autowired
	protected JdbcTemplate jdbcTemplate;
	@Autowired
	private DataBaseTestConfigurer dataBaseTestConfigurer;
	
	protected WebDriver webDriver;
	
	@Before
	public void setUp() throws Exception {
		dataBaseTestConfigurer.prepareSystemtestDatabase();
		this.webDriver = new FirefoxDriver();
	}
	
	@After
	public void tearDown() {
		webDriver.quit();
	}
	
}
